
/**
\file
Defines the rainbow::depth_state class.
\author Sean Tromans
*/

#ifndef	RAINBOW_GRAPHICS_DEVICE_DEPTH_STATE_HPP
#define	RAINBOW_GRAPHICS_DEVICE_DEPTH_STATE_HPP

#include <sun/gl.hpp>
#include <sun/lua/lua_fwd.hpp>

namespace rainbow
{

	/**
	Defines the settings for a user defined GPU depth state.
	\author Sean Tromans
	*/
	struct depth_state
	{
		/**
		Default Constructor.
		\author Sean Tromans
		*/
		depth_state( );

		/**
		Applies any changes from the provided depth_state to OpenGL.
		@param other The currently active depth_state.
		\author Sean Tromans
		*/
		void apply( depth_state const & other ) const;

		bool	test_enabled;	///< Whether or not the depth test is enabled.
		bool	write_enabled;	///< Whether or not depth writes are enabled.

		GLenum		depth_func;	///< The function to use when performing depth comparrisons.
		GLclampd	depth_near;	///< The depth of the near clipping plane.
		GLclampd	depth_far;	///< The depth of the far clipping plane.

		/**
		Exposes the depth_state to lua.
		@param L The Lua State being initialised.
		\author Sean Tromans.
		*/
		static void lua_interface( lua_State * L );
	};

	/**
	Comparrison operator for depth_states.
	@param lhs The first depth_state being compared.
	@param rhs The second depth_state being compared.
	@return True if the depth_states are equal.
	\author Sean Tromans
	*/
	bool operator == ( depth_state const & lhs, depth_state const & rhs );

}

#endif	//RAINBOW_GRAPHICS_DEVICE_DEPTH_STATE_HPP
